package com.sky.merchant.service;

import com.sky.common.core.redis.RedisCache;
import com.sky.merchant.domain.ResShop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.TimeUnit;

@Service
public class RedisShopService {

    @Autowired
    private RedisCache redisCache;

    private static final String RES_SHOP_KEY_PREFIX = "resShop:";

    public void cacheResShop(Long id, ResShop resShop) {
        redisCache.setCacheObject(RES_SHOP_KEY_PREFIX + id,resShop, 3, TimeUnit.MINUTES);
    }

    public ResShop getResShop(Long id) {
        return redisCache.getCacheObject(RES_SHOP_KEY_PREFIX + id);
    }
}